﻿@model Tasks.UI.Models.NoticeReadStateModel
@{
    Layout = null;
}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>通知列表界面</title>
    <link href="@Config.GetCssResourcePath("main.css")" rel="stylesheet" type="text/css" />
    <link href="@Config.GetCssResourcePath("table.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Scripts/jquery-impromptu.3.1.css")" rel="stylesheet" type="text/css" />
    <script src="@Url.Content("~/Scripts/jquery-1.5.1.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery-impromptu.3.1.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/global.js")" type="text/javascript"></script>
    <script type="text/javascript">
        $().ready(function () {
            //全选按钮
            $("#checkall").click(function () {
                $.ctrl.checked("input[name='checkbox']");
            });
        });
        //全部设为已读
        function seeAll() {
            var v = $.ctrl.getCheckedValue("input[name='checkbox']", "input[name='NoticeID']");

            if (v != null && v != "") {
                window.location = "/Home/RemindList?NoticeIDValue=" + v;
            }
            else {
                $.Msg.alert("", "请选择消息！");
            }
        }
        function goto(act) {
            $("#form1").submit();
        }
        //切换选项卡
        function selectTab(num) {
            $("#ReaderState").val(num);
            $("#PageIndex").val(1);
            goto("search");
        }
    </script>
</head>
<body>
    <form id="form1" method="post" action="/Home/RemindList">
    <input id="NoticeIDValue" type="hidden" name="NoticeIDValue" />
    @Html.HiddenFor(t => t.ReaderState)
    <div id="container">
        <div class="navTitle">
            消息管理</div>
        <ul class="tabsClass" style="width: 980px;">
            <li><a href="javascript:selectTab('0')" class="@(Model.ReaderState == 0 ? "selected" : "")">
                全部</a> </li>
            <li><a href="javascript:selectTab('1')" class="@(Model.ReaderState == 1 ? "selected" : "")">
                已读</a> </li>
            <li><a href="javascript:selectTab('2')" class="@(Model.ReaderState == 2 ? "selected" : "")">
                未读</a> </li>
        </ul>
        <table class="tblStyle1" border="1">
            <thead>
                <tr>
                    <th style="width: 80px;">
                        <span id="checkall" style="">全/反选</span>
                    </th>
                    <th>
                        消息内容
                    </th>
                    <th style="width: 80px;">
                        日期
                    </th>
                    <th style="width: 80px;">
                        状态
                    </th>
                    <th style="width: 100px;">
                        操作
                    </th>
                </tr>
            </thead>
            <tbody id="tbtbuy">
                @foreach (Notice notice in Model.NoticeList)
                {
                    <tr>
                        <td>
                            <input id="Checkbox1" type="checkbox" name="checkbox" />
                            <input id="NoticeID" type="hidden"  name="NoticeID" value="@notice.NoticeID"/>
                        </td>
                        <td>
                            <a href="javascript:void(0)" onclick="parent.addTab('消息管理','/Home/AddNoticesReaderState?NoticeID=@notice.NoticeID',true)" style="float:left" >@notice.NoticeContent</a>
                        </td>
                        <td>
                            @notice.NoticeDate.ToShortDateString()
                        </td>
                        <td>
                            @if (notice.ReaderState == 1)
                            {
                                <span>已读 </span>
                            }
                            else
                            { 
                                <span>未读 </span>
                            }
                        </td>
                        <td>
                            <a href="javascript:void(0)" onclick="parent.addTab('消息管理','/Home/AddNoticesReaderState?NoticeID=@notice.NoticeID',true)" >
                                查看</a>
                        </td>
                    </tr>
                }
            </tbody>
        </table>
        <div style="" id="divxz">
            <a href="javascript:void(0)" id="seecheckall" onclick="seeAll()">设为已读</a></div>
        <div style="text-align: left;">
            @Html.RenderPageNav(Model.PageIndex, Model.PageSize, Model.RowCount, "", PageNavStyle.Form)</div>
    </div>
    </form>
</body>
</html>
